<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>VT100.net: Digital VT102 User Guide</TITLE>
<LINK HREF="vt102-ug.css" TYPE="text/css" REL="stylesheet">
</HEAD>
<BODY>
<DIV CLASS="navbar"><A HREF="http://vt100.net/"><IMG CLASS="button" SRC="vt100.net-logo.png" ALT="VT100.net" HEIGHT="16" WIDTH="102"></A> VT102 User Guide<TABLE WIDTH="100%">
<COL SPAN="3" WIDTH="33%">
<TBODY>
<TR>
<TD ALIGN="LEFT"><A HREF="appendixc.html">Appendix C</A></TD>
<TD ALIGN="CENTER"><A HREF="contents.html">Contents</A></TD>
<TD ALIGN="RIGHT"><A HREF="appendixe.html">Appendix E</A></TD>
</TR>
</TBODY>
</TABLE>
<HR></DIV>
<H1 ID="SD"><SPAN CLASS="chapnum">D</SPAN> Control Functions (Sequence Formats)</H1>
<H2 ID="SD.1" CLASS="notoc">General</H2>
<P>This appendix summarizes the ANSI code extension techniques defined in
standards X3.41-1974 and X3.64-1979. Those specifications cover many
special cases and details not included here.</P>
<H2 ID="SD.2" CLASS="notoc">Control Functions</H2>
<P>The ANSI standards define types of characters used for specific purposes.
You can determine a character's type by its position in the ASCII
table (<A HREF="tabled-1.html">Table D-1</A>). There are two general categories of characters:</P>
<UL>
<LI>display (columns 2 through 7)</LI>
<LI>control (columns 0 and 1).</LI>
</UL>
<P>This table and the ANSI system can work for either a 7-bit or 8-bit character
environment. The VT102 uses only 7-bit characters.</P>
<P CLASS="note">NOTE: The ASCII 7-bit table corresponds to International Standards Organization
(ISO) standard 646 and International Telegraph and Telephone
Consultive Committee (CCITT) alphabet 5.</P>
<P>All control characters and groups of characters (sequences) not intended
for display on the screen are control functions. Not all control functions
perform an action in every ANSI device, but each device can recognize all
control functions and discard any that do not apply to it. Therefore, each
device performs a subset of the ANSI functions.</P>
<P>Because different devices use different subsets, compliance with ANSI
does not mean compatibility between devices. Compliance only means
that a particular function, if defined in the ANSI standard, is invoked by the
same control function in all devices. If an ANSI device does not perform
an action that has a control function defined in the ANSI standard, it cannot
use that control function for any other purpose.</P>
<H2 ID="SD.3" CLASS="notoc">Escape and Control Sequences</H2>
<P>Escape and control sequences provide more controls in addition to the
control characters in the ASCII 7-bit table. These multiple-character control
sequences are not displayed but control the displaying, processing,
and transmission of characters. At the end of a sequence or during an
error condition, the terminal continues to display received characters.
See <A HREF="chapter5.html#S5.5.1">Error Recovery</A> in <A HREF="chapter5.html">Chapter 5</A> for specific error conditions.</P>
<H3 ID="SD.3.1" CLASS="notoc">Escape Sequences</H3>
<P>The format for an escape sequence is as follows.</P>
<PRE>ESC           I.....I         F
033           040-057         060-176

Escape        Intermediate    Final
sequence      characters      character
introducer    (0 or more      (1 character)
              characters)</PRE>
<DL>
<DT>Escape Sequence Introducer</DT>
<DD><P>This is the ESC character (octal 033) defined
by ANSI X3.4-1977. After receiving ESC, the terminal stores (but
does not display) all control characters received in the proper range.</P></DD>
<DT>Intermediate Characters</DT>
<DD><P>These are characters received after ESC in
the octal range of 040 - 057 (column 2 of the ASCII table). The terminal
stores intermediate characters as part of the control function.</P></DD>
<DT>Final Character</DT>
<DD><P>This is a character received after ESC in the octal
range of 060 - 176 (columns 3 - 7 of the ASCII table). The final character
indicates the end of the control function. The intermediate and final characters
together define the function of the sequence. The terminal then
performs the specified function and continues to display received characters.
ANSI standard control functions have a final character in the octal
range of 100 - 176 (columns 4 - 7 of the ASCII table). Private sequences
have a final character in the octal range of 060 - 077 (column 3 of the
ASCII table).</P></DD>
</DL>
<H4>Example</H4>
<P>Action: Designate ASCII character set as G0.</P>
<H4>Sequence</H4>
<PRE>ESC   (    B
033  050  102
 |    |    |
 |    |    +------- Final Character
 |    +------------ Intermediate Character
 +----------------- Escape Sequence Introducer</PRE>
<H3 ID="SD.3.2" CLASS="notoc">Control Sequence Format</H3>
<P>The format of a control sequence is as follows.</P>
<PRE>CSI           P.....P        I.....I         F
033 133       060-077        040-057         100-176

Control       Parameter      Intermediate    Final character
sequence      characters     characters      (1 character)
introducer    (0 or more     (0 or more
              characters)    characters)</PRE>
<DL>
<DT>Control Sequence Introducer</DT>
<DD><P>The CSI is the ESC (octal 033) and [ (octal
133) characters defined by ANSI X3.41-1977. These characters provide
8-bit control functions by using 7-bit characters. The VT102 supports
only 7-bit characters. After receiving CSI characters, the terminal stores
(but does not display) all control characters received in the proper range.</P></DD>
<DT>Parameter Characters</DT>
<DD><P>These are characters received after the CSI
character, in the octal range of 060 - 077 (column 3 of the ASCII table).
The parameter characters modify the action or interpretation of the control
function. The terminal interprets parameter characters as private
when the &lt; = &gt; ? characters (octal 074 - 077) begin the paramter
string. The : character (octal 072) is reserved. This means an ANSI-specified
control sequence can have a parameter function with a private interpretation.</P>
<P>The terminal uses two types of parameter characters, numeric and selective.
A numeric parameter represents a decimal number, designated by
Pn. The decimal characters have a range of 0 - 9 (octal 060 - 071). A
selective parameter comes from a list of specified parameters, designated
by Ps.</P>
<P>If a control sequence includes more than one parameter, the parameters
are separated by a delimiter, the ; character (octal 073).</P></DD>
<DT>Intermediate Characters</DT>
<DD><P>These are characters received after the CSI
character, in the octal range of 040 - 057 (column 2 of the ASCII table).
The terminal stores these characters as part of the control function.</P>
<P CLASS="note">NOTE: The terminal does not use intermediate characters in control
functions.</P></DD>
<DT>Final Character</DT>
<DD><P>This is a character received after the CSI character, in
the octal range of 100 - 176 (columns 4 - 7 of the ASCII table). The final
character indicates the end of the control function. The intermediate and
final characters together define the function of the sequence. The terminal
then performs the specified function and continues to display received
characters. ANSI standard control functions have a final character in the
octal range of 100 - 157 (columns 4 - 6 of the ASCII table). Private sequences
have a final character in the octal range of 160 - 176 (column 7
of the ASCII table).</P></DD>
</DL>
<H4>Example</H4>
<P>Action: Clear all horizontal tabs.</P>
<H4>Sequence</H4>
<PRE>ESC   [    3    g
033  133  063  147
 |    |    |    |
 +--+-+    |    |
    |      |    +----- Final Character
    |      +---------- Parameter Character
    +----------------- Control Sequence Introducer</PRE>
<H4>Sequence Examples</H4>
<P>These examples show the use of multiple functions selected in one sequence,
private parameters and private sequences.</P>
<PRE>ESC   [    ?    4    h          Set smooth scroll mode
033  133  077  064  150         (? = ANSI private parameter)

ESC   [    2    ;    1    y     Invoke self-test
033  133  062  073  061  171    (y = ANSI private sequence)</PRE>
<DIV CLASS="navbar"><HR>
<TABLE WIDTH="100%">
<COL SPAN="3" WIDTH="33%">
<TBODY>
<TR>
<TD ALIGN="LEFT"><A HREF="appendixc.html">Appendix C</A></TD>
<TD ALIGN="CENTER"><A HREF="contents.html">Contents</A></TD>
<TD ALIGN="RIGHT"><A HREF="appendixe.html">Appendix E</A></TD>
</TR>
</TBODY>
</TABLE>
<DIV CLASS="navbot">http://vt100.net/docs/vt102-ug/appendixd.html</DIV></DIV>
</BODY>
</HTML>
